import instance from "@/API/axios";

// 课程
function courses(data) {
    return instance.post('/api/weChat/applet/course/list/type', data)
}

// 直播课程
function live(data) {
    return instance.post('/api/pc/liveCourseInfo/list', data)
}

// 轮播图
function carousel() {
    return instance.get('/api/weChat/applet/course/banner/list?number=5')
}

// 头部下拉框
function drop_down(data) {
    return instance.post('/api/weChat/applet/subject/list', data, {
        headers: {'Content-Type': 'application/json'}
    })
}

// 底部友情连接
function footer(data) {
    return instance.post('api/system/dict/data/list/open', data)
}
// 课程详情
function details(courseIdList){
    return instance.get('api/pc/course/detail/'+courseIdList)
}
// 获取评论
 function review(courseIdList){
    return instance.get('api/weChat/applet/comment/commentList/course/'+courseIdList)
 }
// 登录
function Login(data){
    return instance.post('/api/pcUser/login', data)
}
// 手机登录
function mobieLogin(data){
    return  instance.post('/api/pcUser/login/mobile',data)
}
// 获取登录验证码
function mobieCodeBtn(mobie){
    return instance.get('/api/pcUser/login/send/code/'+mobie)
}
// 注册
function zhuce(data){
    return instance.post('api/pcUser/register',data)
}
function zhuceCode(zcmobie){
    return instance.get('/api/pcUser/register/send/code/'+zcmobie)
}
// 推出登录
function outlogin(){
   return  instance.get('/api/pcUser/logout')
}
// 查看当前登录用户个人信息
function viewLogin(){
    return  instance.get('/api/pcUser/login-user/info')
}
// 修改头像
function Modifyavatar(file){
    return  instance.post('/api/pcUser/updata/userAvatar',file,{
        headers:{
            'Content-Type':'multipart/form-data'
        }
    })
}
// 修改昵称
function setuserInfo(data){
    return instance.post('/api/pcUser/update/userInfo',data,{
            headers: {'Content-Type':'application/json'}
    })
}

// 头条精选
function TopTips(data){
    return instance.post('/api/weChat/applet/article/list',data,{
        headers: {'Content-Type':'application/json'}
    })
}

// 榜单
function Courselist(){
    return instance.get('/api/best-selling/course/list')
}
export {courses,
    live,
    carousel,
    drop_down,
    footer,
    details,
    review,
    Login,
    mobieLogin,
    mobieCodeBtn,
    zhuce,
    zhuceCode,
    outlogin,
    viewLogin,
    Modifyavatar,
    setuserInfo,
    TopTips,
    Courselist
}